# Filters added to this controller will be run for all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class Admin::AdminApplicationController < ActionController::Base
  # Be sure to include AuthenticationSystem in Application Controller instead
  include AuthenticatedSystem
  
  def redirect_post_url(post)
    if post.class == CommonPost
      redirect_to admin_common_post_url(post.community.district, post.community, post)
    elsif post.class == GroupPost
      redirect_to admin_group_post_url(post.group, post)
    elsif post.class == SitePost
      redirect_to admin_site_post_url(post.site, post)
    end
  end
  
  def top_post_category
    @categories = PostCategory.find(:all, :conditions => [ "parent_id = 0"], :order => "position DESC").map{|u| [u.title, u.id]}
  end
end